package cn.hefan.dao;

import java.sql.SQLException;

import org.apache.commons.dbutils.QueryRunner;
import org.apache.commons.dbutils.handlers.BeanHandler;

import cn.hefan.domain.Admin;
import cn.hefan.util.DataSourceUtils;

public class LoginDao {

	public static Admin adminLogin(String username,String password) throws SQLException {
		QueryRunner qr = new QueryRunner(DataSourceUtils.getDataSource());
	    String sql = "select * from admin where username=? and password=?";
		Admin admin = qr.query(sql, new BeanHandler<Admin>(Admin.class),username,password);
		return admin;
	}

}
